<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息表单</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

body {
            background-color: #f0f2f5;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }

.form-container {
            background-color: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
        }

    h1 {
            color: #1a73e8;
            text-align: center;
            margin-bottom: 25px;
            font-size: 24px;
        }

    .form-group {
            margin-bottom: 20px;
        }

    label {
            display: block;
            margin-bottom: 8px;
            color: #5f6368;
            font-weight: 500;
        }

    input[type="text"] {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #dadce0;
            border-radius: 6px;
            font-size: 16px;
            transition: border-color 0.3s;
        }

    input[type="text"]:focus {
            outline: none;
            border-color: #1a73e8;
            box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
        }

        .radio-group, .checkbox-group {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        .radio-item, .checkbox-item {
            display: flex;
            align-items: center;
            gap: 5px;
            color: #3c4043;
        }

        input[type="radio"], input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: #1a73e8;
        }

        button {
            width: 100%;
            padding: 12px;
            background-color: #1a73e8;
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: #1557b0;
        }

        .toast {
            position: fixed;
            top: 20px;
            right: 20px;
            background-color: #34a853;
            color: white;
            padding: 12px 20px;
            border-radius: 6px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            transform: translateX(120%);
            transition: transform 0.3s ease;
            z-index: 1000;
        }

        .toast.show {
            transform: translateX(0);
        }
    </style>
</head>
<body>
    <div class="form-container">
        <h1>用户信息输入</h1>
        <form id="userForm">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" required placeholder="请输入您的用户名">
            </div>

            <div class="form-group">
                <label>性别</label>
                <div class="radio-group">
                    <div class="radio-item">
                        <input type="radio" id="male" name="gender" value="male" required>
                        <label for="male">男</label>
                    </div>
                    <div class="radio-item">
                        <input type="radio" id="female" name="gender" value="female">
                        <label for="female">女</label>
                    </div>
                    <div class="radio-item">
                        <input type="radio" id="other" name="gender" value="other">
                        <label for="other">其他</label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label>兴趣爱好</label>
                <div class="checkbox-group">
                    <div class="checkbox-item">
                        <input type="checkbox" id="reading" name="hobby" value="reading">
                        <label for="reading">阅读</label>
                    </div>
                    <div class="checkbox-item">
                        <input type="checkbox" id="sports" name="hobby" value="sports">
                        <label for="sports">运动</label>
                    </div>
                    <div class="checkbox-item">
                        <input type="checkbox" id="music" name="hobby" value="music">
                        <label for="music">音乐</label>
                    </div>
                    <div class="checkbox-item">
                        <input type="checkbox" id="travel" name="hobby" value="travel">
                        <label for="travel">旅行</label>
                    </div>
                    <div class="checkbox-item">
                        <input type="checkbox" id="gaming" name="hobby" value="gaming">
                        <label for="gaming">游戏</label>
                    </div>
                </div>
            </div>

            <button type="submit">提交</button>
        </form>
    </div>

    <div class="toast" id="submitToast">已提交成功！</div>

    <script>
        const form = document.getElementById('userForm');
        const toast = document.getElementById('submitToast');

        form.addEventListener('submit', function(e) {
            e.preventDefault(); // 阻止表单默认提交行为
            
            // 显示提交成功提示
            toast.classList.add('show');
            
            // 3秒后隐藏提示
            setTimeout(() => {
                toast.classList.remove('show');
            }, 3000);

            // 这里可以添加表单数据处理逻辑
            // 例如收集表单数据并发送到服务器
        });
    </script>
</body>
</html>
    